source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
source "https://code.aliyun.com/mpaas-public/podspecs.git"

platform :ios, '13.0'

target 'XunMi' do
  use_frameworks! :linkage => :static
  inhibit_all_warnings!
  pod 'Masonry', '~> 1.1.0'
  pod 'IQKeyboardManager', '6.5.10'
  pod 'AFNetworking', '~> 4.0.1'
  pod 'MJRefresh', '~> 3.7.9'
  pod 'MJExtension', '~> 3.4.2'
  pod 'YYCategories', '~> 1.0.4'
  pod 'SDWebImageWebPCoder', '~> 0.14.5'
  pod 'FLAnimatedImage', '~> 1.0.17'
  pod 'MBProgressHUD','~> 1.2.0'
  pod 'MMKV', '~> 1.3.4'
  pod 'JXCategoryView', '~> 1.6.3'
  pod 'JXPagingView/Pager', '~> 2.1.3'
  #  pod 'TZImagePickerController', '~> 3.8.4'
  pod 'TZImagePickerController/Basic', '~> 3.8.4'
  pod 'iCarousel'
  pod 'YBImageBrowser', '~> 3.0.9'
  pod 'YBImageBrowser/Video'  #视频功能需添加
  
  pod 'AliyunOSSiOS', '~> 2.10.16'
  pod 'AntVerify', '1.0.0.230307112238'
  pod 'YYImage/WebP', :git => 'https://github.com/QiuYeHong90/YYImage.git'#解决 YBImageBrowser 对 iOS14的适配问题
  pod 'YYImage', :git => 'https://github.com/QiuYeHong90/YYImage.git'#解决 YBImageBrowser 对 iOS14的适配问题
  # 视频播放
  pod 'SJVideoPlayer'
  pod 'SJBaseVideoPlayer', '~> 3.7.7.1'
  #  pod 'FDFullscreenPopGesture', '1.1'
  pod 'BRPickerView', '~> 2.8.0'
  pod 'FGPopupScheduler'
  pod 'QCloudCOSXML/Transfer'#, '6.3.7'
  pod 'OneLoginSDK-iOS-xcframework', '~> 2.9.1'
  pod 'FMDB'
  pod 'WechatOpenSDK-XCFramework', '~> 2.0.4'
  pod 'RongCloudIM/IMLib'#, '5.8.0'
  pod 'RongCloudRTC/RongCallLib'#, '5.8.1'
  pod 'ZHHUnicodeReadable'
  pod 'Protobuf', '~> 3.23.1'
  pod 'SSZipArchive', '~> 2.4.3'
  
  # 本地Pod
  pod 'SDCycleScrollView', :path=>'./XunMi/XMPods/SDCycleScrollView'
  # Debug
  pod 'CocoaLumberjack', '~> 3.8.5'
  pod 'LookinServer', '1.2.6',:configurations => ['Debug']
  pod 'MLeaksFinder', :git => "https://github.com/Tencent/MLeaksFinder.git",:configurations => ['Debug']
end


post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    # 移除arm64 编译报错
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
  
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # 处理版本警告
      if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 13.0
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
      end
      
      # https://github.com/CocoaPods/CocoaPods/issues/11402#issuecomment-1201464693
      if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
        target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
          config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
          config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
          config.build_settings['ENABLE_BITCODE'] = "NO"
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "13.0"
          
          #Fix Xcode15 other links  flag  -ld64
          xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_f
          if xcode_version >= 15
            xcconfig_path = config.base_configuration_reference.real_path
            xcconfig = File.read(xcconfig_path)
            if xcconfig.include?("OTHER_LDFLAGS") == false
              xcconfig = xcconfig + "\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'
            else
              if xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == false
                xcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")
              end
              if xcconfig.include?("-ld64") == false
                xcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')
              end
            end
            File.open(xcconfig_path, "w") { |file| file << xcconfig }
          end
        end
      end
    end
  end
end

